import 'package:flutter/material.dart';
import 'package:fwanandroid/ui/MyColors.dart';

class BottomBarWidget extends StatefulWidget {
  final int currentIndex;
  final Function(int) onItemSelected;

  const BottomBarWidget(
      {super.key, required this.currentIndex, required this.onItemSelected});

  @override
  State<BottomBarWidget> createState() => _BottomBarWidgetState();
}

class _BottomBarWidgetState extends State<BottomBarWidget> {
  @override
  Widget build(BuildContext context) {
    return BottomNavigationBar(
        backgroundColor: Colors.white,
        type: BottomNavigationBarType.fixed,
        onTap: widget.onItemSelected,
        selectedItemColor: MyColors.leiMuBlue,
        unselectedItemColor: Colors.grey,
        showSelectedLabels: true,
        showUnselectedLabels: true,
        currentIndex: widget.currentIndex,
        items: const [
          BottomNavigationBarItem(icon: Icon(Icons.home), label: '首页'),
          BottomNavigationBarItem(icon: Icon(Icons.article), label: '公众号'),
          BottomNavigationBarItem(icon: Icon(Icons.search), label: '搜索'),
          BottomNavigationBarItem(
              icon: Icon(Icons.type_specimen), label: '项目分类'),
          BottomNavigationBarItem(
              icon: Icon(Icons.account_circle_rounded), label: '我'),
        ]);
  }
}
